﻿#ifndef _MSG_QUEUE_H__
#define _MSG_QUEUE_H__

// #ifdef __cplusplus
// extern "C" {
// #endif

// #include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
// #include "config.h"

// #if (EN_WINDOWS)
#include <osa_mqueue.h>
#define  mqd_t                 OSA_MqdHndl
#define  mq_attr               osa_mq_attr
#define  mq_close              OSA_mqClose			
#define  mq_getattr            OSA_mqGetattr		
#define  mq_notify             OSA_mqNotify		
#define  mq_open               OSA_mqOpen			
#define  mq_receive            OSA_mqReceive		
#define  mq_send               OSA_mqSend			
#define  mq_setattr            OSA_mqSetattr		
#define  mq_timedreceive       OSA_mqTimedreceive 	
#define  mq_timedsend          OSA_mqTimedsend     
#define  mq_unlink             OSA_mqUnlink   
#define  mq_delete             OSA_mqDelete
#define  mq_reltimedreceive_np mq_timedreceive
// #elif EN_LINUX
// #include <mqueue.h>
// #define mq_delete 
// #else
// #include <mqueue.h>
// #endif
 
mqd_t create_msg_queue(char *file, int block, int len, int size);
mqd_t get_msg_queue(char *file);
int destory_msg_queue(mqd_t msg_id, char* file);
int close_msg_queue(mqd_t msg_id);
int send_msg_queue(mqd_t msg_id, char* msg, int size, int prio);
int recv_msg_queue(mqd_t msg_id, char* out, int size);
int timedrecv_msg_queue(mqd_t msg_id, char* out, int size, struct timespec *timeout);
int msg_count(mqd_t msg_id);
int msgq_is_empty(mqd_t msg_id);
void msgq_get_last(mqd_t msg_id, char* out, int size);

// #ifdef __cplusplus
// }
// #endif

#endif //!_MSG_QUEUE_H__
